package com.hzncc.flowable_diboot.contract.vo;

import com.diboot.core.binding.annotation.BindDict;
import com.diboot.core.binding.annotation.BindEntity;
import com.diboot.core.binding.annotation.BindEntityList;
import com.diboot.core.binding.annotation.BindField;
import com.diboot.core.vo.LabelValue;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.contract.entity.*;
import com.hzncc.flowable_diboot.entity.SapCustomer;
import com.hzncc.flowable_diboot.project_contracts.entity.ProjectContractAudit;
import com.hzncc.flowable_diboot.project_contracts.entity.ProjectContractItem;
import com.hzncc.flowable_diboot.project_contracts.entity.ProjectSamContract;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.List;

/**
 * 销售合同 VO定义
 *
 * @author MyName
 * @version 1.0
 * @date 2024-09-02
 * Copyright © MyCorp
 */
@Getter
@Setter
@Accessors(chain = true)
public class SalesContractListVO extends SalesContract {
    private static final long serialVersionUID = 1328421713835510536L;
    /**
     * 业务板块 关联字典选项
     */
    @BindDict(
            type = "contractBusinessModel",
            field = "businessModel"
    )
    private LabelValue businessModelLabel;
    

    /**
     * 销售区域 关联字典选项
     */
    @BindDict(
            type = "salesArea",
            field = "salesTerritory"
    )
    private LabelValue salesTerritoryLabel;

    /**
     * 系统通道 关联字典选项
     */
    //@BindDict(
    //        type = "systemChannel",
    //        field = "systemChannel"
    //)
    //private LabelValue systemChannelLabel;

    /**
     * 交（提）货时间 关联字典选项
     */
    @BindDict(
            type = "deliveryTimeOfTheSalesContract",
            field = "deliveryTime"
    )
    private LabelValue deliveryTimeLabel;

    /**
     * 质量条件 关联字典选项
     */
    @BindDict(
            type = "qualityCondition",
            field = "qualityCondition"
    )
    private LabelValue qualityConditionLabel;

    /**
     * 产品性质 关联字典选项
     */
    @BindDict(
            type = "productNature",
            field = "productNature"
    )
    private LabelValue productNatureLabel;

    /**
     * 付款方式 关联字典选项
     */
    @BindDict(
            type = "paymentMethod",
            field = "paymentMethod"
    )
    private LabelValue paymentMethodLabel;

    /**
     * 分销渠道 关联字典选项
     */
    @BindDict(
            type = "DISTRIBUTE_CHANNEL",
            field = "distributionChannel"
    )
    private LabelValue distributionChannelLabel;

    /**
     * 产品组 关联字典选项
     */
    @BindDict(
            type = "PRODUCTION_GROUP",
            field = "productGroup"
    )
    private LabelValue productGroupLabel;

    /**
     * 发货情况 关联字典选项
     */
    @BindDict(
            type = "deliverySituation",
            field = "deliveryStatus"
    )
    private LabelValue deliveryStatusLabel;

    /**
     * 开票情况 关联字典选项
     */
    @BindDict(
            type = "invoiceSituation",
            field = "invoiceStatus"
    )
    private LabelValue invoiceStatusLabel;

    /**
     * 收款情况 关联字典选项
     */
    @BindDict(
            type = "receiptStatus",
            field = "paymentStatus"
    )
    private LabelValue paymentStatusLabel;

    /**
     * 创建人 关联信息
     */

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.create_by = id"
    )
    private String createByLabel;

    /**
     * 更新人 关联信息
     */

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.update_by = id"
    )
    private String updateByLabel;

    @BindEntity(
            entity = SalesContractExt.class,
            condition = "this.id = sales_contract_id",
            deepBind = true
    )
    private SalesContractExtListVO ext;

    @BindEntity(
            entity = ContractProduct.class,
            condition = "this.contract_product_id = id",
            deepBind = true
    )
    private ContractProduct product;

    @BindEntity(
            entity = ProjectSamContract.class,
            condition = "this.project_contract_id = contract_id",
            deepBind = true
    )
    private ProjectSamContract projectSamContract;

    @BindEntityList(
            entity = SalesContractMrl.class,
            condition = "this.id = sales_contract_id",
            deepBind = true
    )
    private List<SalesContractMrl> mrlList;

    @BindField(
            entity = SapCustomer.class,
            field = "name",
            condition = "this.soldToParty = id"
    )
    private String soldToPartyLabel;

    @BindEntity(
            entity = SapCustomer.class,
            condition = "this.recipient = id"
    )
    private SapCustomer sapCustomer;

    @BindField(
            entity = SapCustomer.class,
            field = "name",
            condition = "this.recipient = id"
    )
    private String recipientLabel;

    @BindField(
            entity = IamUser.class,
            field = "realname",
            condition = "this.salesEmployee = id"
    )
    private String salesEmployeeLabel;

    /**
     * 合同总金额
     */
    private BigDecimal totalAmount;
}